package com.weimob.cloud.api.shop.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.io.Serializable;
import java.util.Arrays;
import java.util.List;

/**
 * 微盟售后订单状态
 */
@RequiredArgsConstructor
@Getter
public enum WeimobShopAfterSalesStatusEnum implements Serializable {

    /**
     * 无售后
     */
    NONE(0),

    /**
     * 买家发起售后
     */
    BUYER_INITIATED(1),

    /**
     * 等待买家退货
     */
    WAITING_RETURN(2),

    /**
     * 买家已退货
     */
    RETURNED(3),

    /**
     * 系统退款中
     */
    SYSTEM_REFUNDING(5),

    /**
     * 售后完成
     */
    COMPLETED(6),

    /**
     * 买家已取消
     */
    CANCELLED(7),

    /**
     * 商家已拒绝
     */
    REJECTED(8),

    /**
     * 退款失败
     */
    REFUND_FAILED(9),

    /**
     * 商家退款中
     */
    MERCHANT_REFUNDING(10),

    /**
     * 换货中
     */
    EXCHANGING(20),

    /**
     * 商家拒绝_待平台介入
     */
    REJECTED_PENDING_PLATFORM(30),

    /**
     * 待平台介入_仲裁中
     */
    PLATFORM_ARBITRATING(31),
    ;

    private final int code;

    /**
     * 有效售后单状态
     */
    public static final List<Integer> EFFECT_AFTER_SALE_STATUS = Arrays.asList(
            NONE.getCode(),
            CANCELLED.getCode(),
            REJECTED.getCode()
    );

    /**
     * 售后审核中状态
     */
    public static final List<Integer> APPLYING_STATUS = Arrays.asList(
            BUYER_INITIATED.getCode(),
            REJECTED_PENDING_PLATFORM.getCode(),
            PLATFORM_ARBITRATING.getCode()
    );

    /**
     * 审核通过的售后
     */
    public static final List<Integer> APPROVED_STATUS = Arrays.asList(
            WAITING_RETURN.getCode(),
            RETURNED.getCode(),
            SYSTEM_REFUNDING.getCode(),
            COMPLETED.getCode(),
            REFUND_FAILED.getCode(),
            MERCHANT_REFUNDING.getCode()
    );
}
